//
//  WFInformationCell.m
//  谷居
//
//  Created by dllo on 16/6/25.
//  Copyright © 2016年 刘万方. All rights reserved.
//

#import "WFInformationCell.h"
#import "UIImageView+AFNetworking.h"
#import "WFHandleURL.h"
@implementation WFInformationCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell {
    self.contentView.backgroundColor = [UIColor lightGrayColor];
    _mainImageView = [[WFImageView alloc] init];
    [self.contentView addSubview:_mainImageView];
    [_mainImageView release];

}

- (void)layoutSubviews {
    [super layoutSubviews];
    CGFloat h = (SCREEN_WIDTH - 10) * ((CGFloat)self.imgModel.height / (CGFloat)self.imgModel.width);
    NSLog(@"cellh: %f", h);
    _mainImageView.frame = CGRectMake(5, 0, SCREEN_WIDTH - 10, self.contentView.frame.size.height);
    [_mainImageView setImageWithURL:[NSURL URLWithString:[WFHandleURL getPicURL:(self.imgModel.photoId).integerValue]] placeholderImage:nil];
}
@end
